﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.Design;
using Water.Web.Controls;
using System.IO;
namespace Water.Web.Controls.Design
{
    public class PagerControlDesigner : ControlDesigner
    {
        private Pager pager;

        public override string GetEditableDesignerRegionContent(System.Web.UI.Design.EditableDesignerRegion region)
        {
            region.Selectable = false;
            return null;
        }

        public override string GetDesignTimeHtml()
        {
            pager = (Pager)Component;
            pager.RecordCount = 225;
            StringWriter sw = new StringWriter();
            HtmlTextWriter writer = new HtmlTextWriter(sw);
            pager.RenderControl(writer);
            return sw.ToString();
        }

        protected override string GetErrorDesignTimeHtml(Exception e)
        {
            string errorstr = "Error creating control：" + e.Message;
            return CreatePlaceHolderDesignTimeHtml(errorstr);
        }

        //public override DesignerActionListCollection ActionLists
        //{
        //    get
        //    {
        //        DesignerActionListCollection actionLists = new DesignerActionListCollection();
        //        //actionLists.Add(new AspNetPagerActionList(this.Component));
        //        return actionLists;
        //    }
        //}
    }
}
